import request from '@/utils/request'

// 查询服务项列表
export function listItem(query) {
  return request({
    url: '/business/item/list',
    method: 'get',
    params: query
  })
}

// 查询服务项列表（不分页）
export function allItem(query) {
  return request({
    url: '/business/item/list',
    method: 'get',
    params: query,
    headers: {'cmd': 'all'}
  })
}

// 查询服务项详细
export function getItem(id) {
  return request({
    url: '/business/item/' + id,
    method: 'get'
  })
}

// 新增服务项
export function addItem(data) {
  return request({
    url: '/business/item',
    method: 'post',
    data: data
  })
}

// 修改服务项
export function updateItem(data) {
  return request({
    url: '/business/item',
    method: 'put',
    data: data
  })
}

// 删除服务项
export function delItem(id) {
  return request({
    url: '/business/item/' + id,
    method: 'delete'
  })
}

// 上架
export function saleOn(id){
  return request({
    url: '/business/item/' + id,
    method: 'patch',
    headers: {'cmd': 'saleOn'},
  })
}

// 下架
export function saleOff(id){
  return request({
    url: '/business/item/' + id,
    method: 'patch',
    headers: {'cmd': 'saleOff'},
  })
}

// 获取审核信息
export function getAuditInfo(id) {
  return request({
    url: '/business/item/' + id + '/auditInfo',
    method: 'get',
  })
}

// 发起审核流程
export function startAudit(params) {
  return request({
    url: '/business/item/startAudit',
    method: 'post',
    data:params
  })
}